"""
已知: a + b + c = 1000; a^2 + b^2 = c^2; a, b, c都是自然数, 求a, b, c 所有满足条件的组合
"""
import time

start_time = time.time()
# for a in range(1001):  # 1000
#     for b in range(1001):  # 1000
#         for c in range(1001):  # 1000
#             if 1000 == a + b + c and a ** 2 + b ** 2 == c ** 2:
#                 print("a, b, c = {}, {}, {}".format(a, b, c))
# # 1000 * 1000 * 1000 * 10 == 10 * 1000^3
# # T(n) = 10 * n^3  ==> O(n^3)
# # cost time : 132.17315793037415
for a in range(1001):  # 1000
    for b in range(1001):  # 1000
        c = 1000 - a - b  # 3
        if a ** 2 + b ** 2 == c ** 2:  # 5
            print("a, b, c = {}, {}, {}".format(a, b, c))  # 2
# # 1000 * 1000 * 10(3+5+2) == 10 * 1000^2
# # T(n) = 10 * n^2  ==> O(n^2)
# # cost time : 1.105098009109497
end_time = time.time()
cost_time = end_time - start_time
print("cost time : {}".format(cost_time))
